<h1 align = 'center'>RESERVATION LIST FOR TODAY</h1>
<?php
    $this->load->database();
    $detailsQ = 'SELECT FacilityName,ScheduledFrom,ScheduledTo,faculty_member.FirstName,faculty_member.LastName, ReservationBy FROM pf_reservation, pf_facilities, faculty_member WHERE pf_reservation.FacilityID = pf_facilities.FacilityID AND pf_reservation.ReservationFor = faculty_member.MemberID AND pf_reservation.ReservationDate = \''.date('Y-m-d').'\'';
    $detailsR = $this->db->query($detailsQ);
    if($detailsR->num_rows() > 0)
    {    
        echo '<table align = "center" border = 5 width = "90%"><tr><th>Facility Name</th><th>Schedule</th><th>Reservation For</th><th>Reservation By</th></tr>';
        foreach($detailsR->result() as $details)
        {
            echo '<tr><td align = "center">'.$details->FacilityName.'</td><td align = "center">'.$details->ScheduledFrom.' - '.$details->ScheduledTo.'</td><td align = "center">'.$details->FirstName.' '.$details->LastName.'</td><td align = "center">'.$details->ReservationBy.'</td></tr>';
        }
        echo '</table>';
    }
    else
    {
        echo '<i><h5 align = "center">no reservations for today</h5></i>';
    }
    echo '<hr>';
    echo '<h3 align = "center">RESERVATION LIST</h3>';
    $detailsQ = 'SELECT FacilityName,ScheduledFrom,ScheduledTo,faculty_member.FirstName,faculty_member.LastName,ReservationDate,ReservationBy FROM pf_reservation, pf_facilities, faculty_member WHERE pf_reservation.FacilityID = pf_facilities.FacilityID AND pf_reservation.ReservationFor = faculty_member.MemberID AND pf_reservation.ReservationDate != \''.date('Y-m-d').'\' GROUP BY ReservationDate';
    $detailsR = $this->db->query($detailsQ);
    if($detailsR->num_rows() > 0)
    {    
        echo '<table align = "center" border = 5 width = "90%"><tr><th>Reservation Date</th><th>Facility Name</th><th>Schedule</th><th>Reservation For</th><th>Reservation By</th></tr>';
        foreach($detailsR->result() as $details)
        {
            echo '<tr><td align = "center">'.$details->ReservationDate.'</td><td align = "center">'.$details->FacilityName.'</td><td align = "center">'.$details->ScheduledFrom.' - '.$details->ScheduledTo.'</td><td align = "center">'.$details->FirstName.' '.$details->LastName.'</td><td align = "center">'.$details->ReservationBy.'</td></tr>';
        }
        echo '</table>';
    }
    else
    {
        echo '<i><h5 align = "center">reservation list empty</h5></i>';
    }
?>